const express = require('express');
const app = express();
var bodyParser = require('body-parser');
var jsonParser = bodyParser.json();
var urlencodedParser = bodyParser.urlencoded({ extended: false });


app.get('/get', function(req, res) {
  // 直接返回对象
  res.send({ name: '小杜' });
});

app.post('/save',urlencodedParser, function(req, res) {
  // 直接返回对象
  console.log(req.data)
  res.send({ status: 200 });
});

app.listen('8001', () => {
  console.log('服务器启动成功');
});